package com.openxt.nbzj.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.openxt.nbzj.R;
import com.openxt.nbzj.view.RollView;

import java.util.List;

/**
 * Created by 颖杰_2 on 2016/7/6.
 */
public class RollViewAdapter{
    List<String> mList;

    public RollViewAdapter(List<String> mList){
        this.mList = mList;
    }

    public int getCount() {
        return mList.size();
    }

    public String getItem(int position) {
        return mList.get(position);
    }

    public View getView(RollView parent) {
        return LayoutInflater.from(parent.getContext()).inflate(R.layout.roll_item, null);
    }

    /**
     * 条目数据适配
     * @param view
     * @param data
     */
    public void setItem(final View view, final String data) {
        TextView tv = (TextView) view.findViewById(R.id.label);
        tv.setText(data);
    }
}
